﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;

namespace FuelTracker.Models
{
    public class Vehicle
    {
        public Guid Id { get; set; }

        public String Name { get; set; }
        public List<FuelLog> FuelLogs { get; set; }

        public decimal AvgConsumption
        {
            get
            {
                return FuelLogs.Average(f => f.AvgConsumption);
            }
        }

        /*
         * Parameterloser Konstruktur fuer die Serialisierung
         */
        public Vehicle()
        {
            FuelLogs = new List<FuelLog>();
        }

        public Vehicle(string name) : this()
        {
            Id = Guid.NewGuid();
            Name = name;
        }

    }
}
